package com.cleverdevices.kevin;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;

public class Splash extends Activity{

	MediaPlayer ourSong;
	
	@Override
	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);	//references the layout we made
		
		//PLAYING A SOUND CLIP
		ourSong = MediaPlayer.create(Splash.this, R.raw.meow);	//setting up the context, resource id
		ourSong.start();	//start the sound
		
		Thread timer = new Thread(){
			public void run(){
				try{
					sleep(2000);	//pauses our thread and not do anything for however long
				} catch (InterruptedException e){
					e.printStackTrace();
				} finally{
					Intent openStartingPoint = new Intent("com.cleverdevices.kevin.MENU");	//create a new intent with the action name of the activity (defined in XML)
					startActivity(openStartingPoint);												//start the activity we just created by passing the intent
				}
				
			}
		};
		timer.start();
	}

	@Override
	protected void onPause() {
		super.onPause();
		ourSong.release();
		finish();	//destroying the activity
	}
	
	
	

}
